package ioParation;

import book.Book;
import book.BookList;
import jdk.swing.interop.SwingInterOpUtils;

import java.util.Scanner;

public class FindParaton implements  IoParation{
    public void work(BookList bookList){
        System.out.println("正在查找图书中。。。。。");
        System.out.println("输入你要查找的书籍");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        int currentSized = bookList.getUsedSized();
        for (int i = 0; i <currentSized; i++) {
            Book book = bookList.getBook(i);
            if(book.getName().equals(name)){
                System.out.println("找到了这本书");
                System.out.println(book);
                return;
            }
        }
        System.out.println("很抱歉，暂时没有这一本书");
    }
}
